<template>
  <div class="myDiv">

    <div ref="chart" style="width: 100%; height: 320px;"></div>

  </div>
</template>

<script>
import * as echarts from 'echarts';
import { getPieData } from "@/api/hrmanagement/menhu";
export default {
  name: '',
  
  props:{
},
  data(){
    return {
     // 饼图数据
     pieData: {
        // ECharts 配置项
        tooltip: {
          trigger: 'item',
          formatter: '{a} <br/>{b} : {c} ({d}%)'
        },
        legend: {
          orient: 'vertical',
          left: 'left',
          data: ['男', '女']
        },
        series: [
          {
            name: 'Pie Chart',
            type: 'pie',
            radius: '55%',
            center: ['50%', '60%'],
            data: [
              { value: 35, name: '男' },
              { value: 22, name: '女' },
             
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }

    }
  },
  watch:{
},
  computed:{
},
  methods:{
    renderPieChart() {
      const chart = echarts.init(this.$refs.chart);
      chart.setOption(this.pieData);
    }
},
  created(){
    
},
  mounted(){
    getPieData().then(response => {
      console.log(response.data);
      this.pieData.series[0].data = response.data
    this.renderPieChart();
      });
  
}
}
</script>
<style lang="scss" scoped>

</style>